#ifndef FAN_H
#define FAN_H

#include <rthw.h>
#include <rtthread.h>
#include "rtconfig.h"
#include "main.h"
#include "pid.h"

typedef struct 
{
    uint8_t fan_duty;
    uint8_t fan_duty_target;
    uint16_t fan_temperature_target;
}FAN_DATA;

extern FAN_DATA fan_data;

void fan_init(void);
void fan_set_pwm(uint16_t duty);
void heat_set_pwm(uint16_t duty);
float fan_temp_getval(void);
PID temperature_pid_control(uint16_t temperature_target);

#endif

